package day06;

import java.util.Arrays;

public class MathDemo {
   public static void main(String[] args) {
     int [] arr=new int[10];
     for(int i=0;i<arr.length;i++){
         arr[i]=(int )(Math.random()*100);
         System.out.println(arr[i]);
     }
     int max=arr[0];
     for(int i=0;i<arr.length;i++) {
         if (arr[0] < arr[i]) {
             max=arr[i];
         }
     }
       System.out.println("输出最大值为："+max);

     Arrays.sort(arr);
     System.out.println("排序后为：");
     for(int i=0;i<arr.length;i++){
         System.out.println(arr[i]);
     }
     arr=Arrays.copyOf(arr,arr.length+2);
     arr[arr.length-1]=max;


       for(int i=0;i<arr.length;i++){
          System.out.println( arr[i]);
       }
   }

    /*    de("杨二沙", 15);
        de("二炉子", 72);

     int[] c=cd(10,1000);
     for(int i=0;i<c.length;i++){
         int a=c[i];
         System.out.println(a);
     }
        Arrays.sort(c);
     for (int i=0;i<c.length;i++){
         int d=c[i];
      System.out.println(d);
     }



    }


    public static void de(String name, int age) {
        if (age < 18) {
            System.out.println(name + "花姑凉" + " " + "大大的哟西!");
        }
        if (age > 18 && age < 45) {
            System.out.println("你叫" + name + " " + "贵庚:" + age);
        }
        if (age > 60) {
            System.out.println(name + "八格牙路");
        }
    }

    public static int[] cd(int n, int max) {
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = (int) (Math.random() * (max + 1));
        }
        return a;*/
    }




